/*************************************************
Author:
Date: 12/11/2012
Description: 停机或者强制清缓存情况下Cache数据会丢失
Notes:
*************************************************/

#ifndef __CPlayerCacheData_h__
#define __CPlayerCacheData_h__

#include "../status/CUserStatus.h"
#include "../boss/CWorldBossData.h"
#include "../act/CEnemyAtkCity.h"
#include "../act/CAcademyBossData.h"
#include "../act/CManorBattleData.h"
#include "../battle/CBattleRole.h"

class CPlayerCacheData
{
public:
    CPlayerCacheData()
    {
        //这里不能调用Clear()存在Hash会崩
    }
    
    void Clear()
    {
        _uiGID = 0;
	    _stWorldBossRole.Clear();
        _stUserStatus.Clear();
        _stAcademyBossRoleList.Clear();
        _stManorBattleRole.Clear();
    }

    int Init(const char* sBuff)
    {
    	int iRet = 0;
        int iOffset = 0;

	    iRet = _stUserStatus.Init(sBuff + iOffset);
        CT_RETURN(iRet);
        iOffset += CUserStatus::CountSize();

        return 0;
    }

    static size_t CountSize()
    {
        return CUserStatus::CountSize();
    }

public:
    unsigned int                _uiGID;
	CWorldBossRole              _stWorldBossRole;       //世界BOSS用户数据
    CUserStatus                 _stUserStatus;

    CEnemyAtkCityRoleData       _stEnemyAtkCityRole;    //怪物攻城战用户数据
    CEnemyAtkCityRoleHP         _stEnemyAtkCityRoleHP;      //用户血量

    CAcademyBossRoleList        _stAcademyBossRoleList; //学院BOSS用户数据
    CManorBattleRole            _stManorBattleRole;     //领地战用户数据
};

#endif // __CPlayerCacheData_h__

